package com.qs.mall.controller.api;

import com.qs.mall.controller.api.impl.ProductFeignClientCallBack;
import com.qs.mall.dto.Product;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;

/**
 * 创建一个Feign接口，该接口作为Feign调用微服务的核心接口
 * name属性：指定需要调用的微服务名称
 * fallback属性：声明熔断降级时调用的类
 */
@FeignClient(name = "product-service", fallback = ProductFeignClientCallBack.class)
public interface ProductFeignClient {

    @GetMapping(value = "/product/{id}")
    Product findById(@PathVariable("id") Long productId);

}
